package org.jeecg.modules.zhouAdmin.help.controller;

import org.jeecg.modules.zhouAdmin.admin.fabeicCenter.pojo.MlccFabricInfoFirst;
import org.jeecg.modules.zhouAdmin.help.pojo.MlccStandardTestinfo;
import org.jeecg.modules.zhouAdmin.help.service.IExpoetService;
import org.jeecg.modules.zhoupackage.pojo.MlccButtonsInfo;
import org.jeecg.modules.zhoupackage.pojo.MlccDilinniInfo;
import org.jeecg.modules.zhoupackage.pojo.MlccFabricInfo;
import org.jeecg.modules.zhoupackage.pojo.MlccMaterialLibuInfo;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping("/help")
public class HelpExportController {

    @Autowired
    IExpoetService service;

    /**
     * 导出标准尺码
     *
     * @param categoryId 类别id
     */
    @RequestMapping("/exportSize")
    public ModelAndView exportSize(String categoryId) {
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        //导出文件名称
        mv.addObject(NormalExcelConstants.FILE_NAME, "标准尺码");
        //注解对象Class
        mv.addObject(NormalExcelConstants.CLASS, MlccStandardTestinfo.class);
        //自定义表格参数
        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("标准尺码", "标准尺码"));
        //导出数据列表
        mv.addObject(NormalExcelConstants.DATA_LIST, service.exportSize(categoryId));
        return mv;
    }

    /**
     * 导出辅料里布
     *
     * @param categoryId 类别id
     */
    @RequestMapping("/exportlibu")
    public ModelAndView exportlibu(String categoryId) {
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        //导出文件名称
        mv.addObject(NormalExcelConstants.FILE_NAME, "里布列表");
        //注解对象Class
        mv.addObject(NormalExcelConstants.CLASS, MlccMaterialLibuInfo.class);
        //自定义表格参数
        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("里布列表", "里布列表"));
        //导出数据列表
        mv.addObject(NormalExcelConstants.DATA_LIST, service.exportlibu(categoryId));
        return mv;
    }

    /**
     * 导出低领尼列表
     *
     * @param categoryId 类别id
     */
    @RequestMapping("/exportdi")
    public ModelAndView exportdi(String categoryId) {
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        //导出文件名称
        mv.addObject(NormalExcelConstants.FILE_NAME, "底领呢列表");
        //注解对象Class
        mv.addObject(NormalExcelConstants.CLASS, MlccDilinniInfo.class);
        //自定义表格参数
        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("底领呢列表", "底领呢列表"));
        //导出数据列表
        mv.addObject(NormalExcelConstants.DATA_LIST, service.exportdi(categoryId));
        return mv;
    }

    /**
     * 导出纽扣列表
     *
     * @param categoryId 类别id
     */
    @RequestMapping("/exportbotton")
    public ModelAndView exportbotton(String categoryId) {
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        //导出文件名称
        mv.addObject(NormalExcelConstants.FILE_NAME, "纽扣列表");
        //注解对象Class
        mv.addObject(NormalExcelConstants.CLASS, MlccButtonsInfo.class);
        //自定义表格参数
        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("纽扣列表", "纽扣列表"));
        //导出数据列表
        mv.addObject(NormalExcelConstants.DATA_LIST, service.exportbotton(categoryId));
        return mv;
    }

    /**
     * 导出面料列表
     *
     * @param groupid 面料组id
     * @param code    面料编号
     * @param gyscode 供应商编号
     * @param status  状态
     */
    @RequestMapping("/exportfabric")
    public ModelAndView exportfabric(String groupid, String code, String gyscode, Integer status) {
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        //导出文件名称
        mv.addObject(NormalExcelConstants.FILE_NAME, "面料列表");
        //注解对象Class
        mv.addObject(NormalExcelConstants.CLASS, MlccFabricInfo.class);
        //自定义表格参数
        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("面料列表", "面料列表"));
        //导出数据列表
        mv.addObject(NormalExcelConstants.DATA_LIST, service.exportfabric(groupid, code, gyscode, status));
        return mv;
    }

    /**
     * 导出主推面料列表
     */
    @RequestMapping("/exportFirstFabric")
    public ModelAndView exportFirstFabric() {
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        //导出文件名称
        mv.addObject(NormalExcelConstants.FILE_NAME, "主推面料");
        //注解对象Class
        mv.addObject(NormalExcelConstants.CLASS, MlccFabricInfoFirst.class);
        //自定义表格参数
        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("主推面料", "主推面料"));
        //导出数据列表
        mv.addObject(NormalExcelConstants.DATA_LIST, service.exportFirstFabric());
        return mv;
    }
}
